<template>
	<view>
		<ttBar title="提现记录" leftIcon="icon-back"></ttBar>
		<view class="tabCnt">
			<scroll-view :style="{'height':scHeight+'px'}" :scroll-y="true" @scrolltolower="getData">
				<view class="list">
					<view class="row" v-for="(item,index) in list" :key="index">
						<view class="left">
							<text>提现人：{{item.aliName[0]+'**'}}</text>
							<text>支付宝：{{item.aliAccount.substr(0,3)+'******'}}</text>
							<text class="time">{{item.createTime}}</text>
						</view>
						<view class="right">
							<text>￥{{item.amount}}</text>
							<text class="status">{{statusArr[item.status]}}</text>
						</view>
					</view>
					<emptyBox v-if="list.length<1"></emptyBox>
					
				</view>
			</scroll-view>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapGetters,
		mapMutation,
		mapActions
	} from "vuex";
	export default {
		computed: {
			...mapState({
				userInfo: state => state.user.userInfo
			}),
		},
		data() {
			return {
				hasNext:true,
				page_no:1,
				list:[],
				scHeight:uni.getSystemInfoSync().screenHeight-uni.upx2px(90)-uni.getSystemInfoSync().statusBarHeight,
				statusArr:['提现中','提现成功','提现失败']
			};
		},
		methods:{
			getData(){
				if(this.hasNext){
					this.$store.dispatch("apiGetTxHis",{
						userId:this.userInfo.userId,
						page_no:this.page_no,
						page_size:10
					}).then(res=>{
						this.list=this.list.concat(res.data.data.items);
						this.hasNext=res.data.data.hasNext;
						this.page_no=res.data.data.nextPage;
					})
				}else{
					uni.showToast({
						title: '没有更多数据了',
						icon: 'none'
					});
				}
			}
		},
		onLoad() {
			this.getData();
		},
		
		// 下拉刷新
		onPullDownRefresh() {
			setTimeout(() => {
				this.page_no=1;
				this.hasNext=true;
				this.list=[];
				this.getData();
				uni.stopPullDownRefresh();
			}, 1500)
		}
	}
</script>

<style lang="less">
.bg {
		height: 466upx;
		padding: 0 42upx;
		background-image: linear-gradient(0deg,#da2c5c 0%,#e22f43 100%);
		padding-bottom: 120upx;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		margin-bottom: 20upx;
		.ts{
			display: flex;
			width: 100%;
			align-items: center;
			font-size: 32upx;
			color: #FFFFFF;
			justify-content: space-between;
			button{
				margin: 0;
				height: 60upx;
				line-height: 60upx;
				border: none;
				outline: none;
				font-size: 32upx;
				border-radius: 30upx;
				color: #e12f45;
				padding: 0 40upx;
			}
		}
		.count{
			font-size: 80upx;
			color: #FFFFFF;
			margin-top: 40upx;
		}
	}
	.tabHead{
		height: 90upx;
		display: flex;
		justify-content: space-around;
		border-bottom: 2upx solid #f2f2f2;
		text{
			font-size: 32upx;
			line-height: 82upx;
			border-bottom: 6upx solid rgba(0,0,0,0);
			color: #202932;
		}
		.active{
			color: #f79f21;
			border-bottom: 6upx solid #f79f21;
		}
	}
	.list{
		display: flex;
		flex-direction: column;
		
		.item{
			padding: 30upx 70upx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1px solid #EEEEEE;
			text{
				font-size: 32upx;
			}
			.count{
				font-size: 40upx;
				font-weight: bold;
			}
		}
		.row{
			padding: 30upx 32upx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1px solid #EEEEEE;
			.left{
				display: flex;
				flex-direction: column;
				font-size: 28upx;
				margin-bottom: 5upx;
				.time{
					font-size: 24upx;
					color: #999999;
				}
			}
			.right{
				display: flex;
				flex-direction: column;
				align-items: flex-end;
				font-size: 40upx;
				font-weight: bold;
				.status{
					font-size: 28upx;
					color: #999999;
					font-weight: normal;
				}
			}
		}
	}
</style>
